cmake_minimum_required(VERSION 2.8.3)
project(ubt_com)

find_package(catkin REQUIRED COMPONENTS
  message_generation
  roscpp
  geometry_msgs
  tf
)

## Generate messages in the 'msg' folder
add_message_files(FILES
  Rfid.msg
)

## Generate added messages and services with any dependencies listed here
generate_messages(DEPENDENCIES
  geometry_msgs
)

catkin_package(
  LIBRARIES ubt_com_lib # 保证下面的ubt_com_lib放在ubt_com中
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
  include 
  ${catkin_INCLUDE_DIRS}
)

#############
## Install ##
#############
add_library(ubt_com_lib
  src/cJSON.cpp  
  src/ubt_com_util.cpp
  src/ubt_proto_nav.cpp
  src/ubt_proto_adjust.cpp
  src/log/spdlog.cpp
)

add_dependencies(ubt_com_lib ubt_com_generate_messages_cpp ${catkin_EXPORTED_TARGETS})
target_link_libraries(ubt_com_lib
  ${catkin_LIBRARIES}
)

install(TARGETS  ubt_com_lib
  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(DIRECTORY include/${PROJECT_NAME}/  # 安装ubt_com_lib需要的头文件
  DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)